<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/10/13
 * Time: 14:33
 */

class RegionModel extends BaseModel
{
    private $_table;
    protected $_name = 'region';
    protected $_isbug = false;

    public function getOneByIdAndName($id, $name) {
        if(!$id){
            return null;
        }
        $this->_table = new self ();
        $db = $this->_table->getAdapter ();

        $sql = $db->select ()->from ( $this->_name, $name )->where ( "region_id={$id}" )->__toString ();
        if ($this->_isbug == true) {
            echo  __METHOD__.": ".$sql . "<hr/>";
        }
        return $db->fetchOne ( $sql );
    }

}


